﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SqlMiM.Common.ViewModel;
using System.Collections.ObjectModel;
using SqlMiM.Common.Model;
using SqlMiM.SqlServer.ViewModel;
using SqlMiM.SqlServer.Model;
using MvvmFoundation.Wpf;

namespace SqlMiM.SqlServer.ViewModel
{
    public class DatabaseFilesGroupsView : ObservableObject
    {
        
        private Database database;
        private ObservableCollection<FileGroupView> fileGroups;
        private ObservableCollection<Size> allSizes;

        public Database Database
        {
            get { return database; }
            set
            {
                database = value;
                this.RaisePropertyChanged("Database");
            }
        }

   
        public ObservableCollection<FileGroupView> FileGroupsView
        {
            get
            {
                return fileGroups;
            }
            set
            {
                fileGroups = value;
                this.RaisePropertyChanged("FileGroupsView");
            }
        }

        public ObservableCollection<Size> AllSizes
        {
            get
            {
                foreach (FileGroupView fgv in this.FileGroupsView)
                {
                    allSizes.Add(new Size() { Name = fgv.FileGroup.FileGroupName, Value = fgv.FileGroup.CurrentSize });
                }

                return allSizes;
            }
        }


        public DatabaseFilesGroupsView()
        {
            this.FileGroupsView = new ObservableCollection<FileGroupView>();
            this.allSizes = new ObservableCollection<Size>();
        }

    }

}
